package com.yonyou.cyxdms.basedata.service.controller.vehicleproduct;

import com.yonyou.cyxdms.basedata.service.dto.vehiclemodel.*;
import com.yonyou.cyxdms.basedata.service.service.brand.BrandService;
import com.yonyou.cyxdms.basedata.service.service.color.ColorService;
import com.yonyou.cyxdms.basedata.service.service.configure.PackageService;
import com.yonyou.cyxdms.basedata.service.service.model.ModelService;
import com.yonyou.cyxdms.basedata.service.service.product.VsProductService;
import com.yonyou.cyxdms.basedata.service.service.series.SeriesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * （对外接口）
 *      通用-厂商给到后台的车相关基础数据的
 *          展示用数据
 *
 * @author：chenzb
 * @since：2019-10-12
 */
@Api(value = "GeneralBasicDataController", tags = "车相关基础数据对外接口")
@RestController
@RequestMapping("/generalBasicData")
public class GeneralBasicDataController {

    @Autowired
    private BrandService brandService;

    @Autowired
    private ModelService modelService;

    @Autowired
    private ColorService colorService;

    @Autowired
    private SeriesService seriesService;

    @Autowired
    private PackageService packageService;

    @Autowired
    private VsProductService vsProductService;



    /**
     * 通用-新增/更新品牌
     *
     * @param generalBrandDtos
     * @return java.lang.Integer
     * @author chenzb
     * @since 2019/10/11
     */
    @ApiOperation(notes = "通用-新增/更新品牌", value = "通用-新增/更新品牌")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", required = true, dataType = "Long", paramType = "header", value = "userId"),
    })
    @PostMapping("/generalBrands")
    public void addBrandGeneral(@RequestBody List<GeneralBrandDTO> generalBrandDtos) {
         brandService.addBrandGeneral(generalBrandDtos);
    }



    /**
     * 通用-新增/更新车系
     *
     * @param generalSeriesDto
     * @return java.lang.Integer
     * @author chenzb
     * @since 2019/10/12
     */
    @ApiOperation(notes = "通用-新增/更新车系", value = "通用-新增/更新车系")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", required = true, dataType = "Long", paramType = "header", value = "userId"),
    })
    @PostMapping("/generalSeriess")
    public void addSeriesGeneral(@RequestBody List<GeneralSeriesDTO> generalSeriesDto) {
         seriesService.addSeriesGeneral(generalSeriesDto);
    }


    /**
     * 通用-新增/更新车型
     *
     * @param generalModelDTOS
     * @return java.lang.Integer
     * @author chenzb
     * @since 2019/10/12
     */
    @ApiOperation(notes = "通用-新增/更新车型", value = "通用-新增/更新车型")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", required = true, dataType = "Long", paramType = "header", value = "userId"),
    })
    @PostMapping("/generalModels")
    public void addModelGeneral(@RequestBody List<GeneralModelDTO> generalModelDto) {
         modelService.addModelGeneral(generalModelDto);
    }


    /**
     * 通用-新增/更新配置
     *
     * @param generalPackageDto
     * @return java.lang.Integer
     * @author chenzb
     * @since 2019/10/12
     */
    @ApiOperation(notes = "通用-新增/更新配置", value = "通用-新增/更新配置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", required = true, dataType = "Long", paramType = "header", value = "userId"),
    })
    @PostMapping("/generalPackages")
    public void addPackageGeneral(@RequestBody List<GeneralPackageDTO> generalPackageDto) {
         packageService.addPackageGeneral(generalPackageDto);
    }


    /**
     * 通用-新增/更新颜色
     *
     * @param generalCarColorDTOS
     * @return java.lang.Integer
     * @author chenzb
     * @since 2019/10/12
     */
    @ApiOperation(value = "通用-新增/更新颜色", notes = "通用-新增/更新颜色")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", required = true, dataType = "Long", paramType = "header", value = "userId"),
    })
    @PostMapping("/generalAddColor")
    public void addColorGeneral(@RequestBody List<GeneralCarColorDTO> generalCarColorDto) {
         colorService.addColorGeneral(generalCarColorDto);
    }


    /**
     * 通用-新增/更新定义整车产品
     *
     * @param generalVsProductDTOS
     * @return java.lang.Integer
     * @author chenzb
     * @since 2019/10/12
     */
    @ApiOperation(value = "通用-新增/更新定义整车产品", notes = "通用-新增/更新定义整车产品")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", required = true, dataType = "Long", paramType = "header", value = "userId"),
    })
    @PostMapping("/generalAddVsProduct")
    public void addVsProductGeneral(@RequestBody List<GeneralVsProductDTO> generalVsProductDto) {
         vsProductService.addVsProductGeneral(generalVsProductDto);
    }

}
